package com.edu.service.impl;

import com.edu.dao.impl.UserDaoImpl;
import com.edu.entity.UserEntity;
import com.edu.service.UserService;

import java.sql.SQLException;

public class UserServiceImpl implements UserService {
    private UserDaoImpl userDao;

    public UserServiceImpl() {
        this.userDao = new UserDaoImpl();
    }


    public boolean register(String username, String email, String password) {
//        if (!true) {
//            return false;
//        }
        return userDao.createUser(username, email, password);
    }

    public String login(String email, String password) {
        UserEntity user = userDao.getUserByEmailAndPassword(email, password);
        if (user != null) {
            // Generate and return token here
            return "generated-token";
        }
        return null;
    }
}
